﻿<div ms-controller="TSSQLIST">
    <div class="btn-add">
    </div>
     <div class="tab-filter-type">
      <!--  <div class="oh">
            <h5 class="pull-left tr">我的话题：</h5>
            <ul class="tab-type ft14">
                <li><span class="active" ms-click="SelectType('0')">全部</span></li>
                <li ms-click="SelectType('1')"><span>我创建的</span></li>
                <li ms-click="SelectType('2')"><span>我评论的</span></li>

            </ul>
        </div>-->
        <div class="oh">
            <h5 class="pull-left tr">话题类别：</h5>
            <ul class="tab-type ft14">
                <li ms-click="SelectXJType('')"><span class="active">全部</span></li>
                <li ms-repeat-el="TypeData" ms-click="SelectXJType(el.ID)"><span>{{el.TypeName}}</span></li>
            </ul>
        </div>

        <!-- 搜索 -->
        <div class="oh">
            <div class="input-group ml15" style="width:295px;">
                <input type="search" class="form-control" ms-duplex="search.searchcontent" placeholder="搜索话题内容">
                <span class="input-group-addon" ms-click="GetLIST()">搜索</span>
            </div>
        </div>
    </div>
  
    <div class="default-tab ft14 pt20">
        <table class="table table-striped table-responsive table-hover">
            <thead>
                <tr>

                    <th  style="width:80px" class="tc">
                        <!--<div class="icheckbox_square-blue">
                            <input type="checkbox">
                            <span class="iconfont icon-check ft12"></span>
                        </div>-->
                        序号
                    </th>
                    <th  style="width:140px">话题类型</th>
                    <th>话题内容</th>
                    <th style="width:100px">作者</th>
                    <th style="width:140px">操作</th>
                </tr>
            </thead>
            <tbody>
                <tr ms-repeat-el="tmpListData">
           
                    <td class="tc">
                        {{$index+1+page.pagecount*(page.pageindex-1)}}

                    </td>
                    <td>
                                               
                        {{el.TypeName}}</td>
                    <td class="lk" ms-click="View(el.ID)">   <img ms-if="el.Status=='1'" src="/ViewV5/images/zxpx/zhiding.png" alt="Alternate Text" style="height:18PX" /> {{ComFunJS.convstr(el.HTNR,40)}}</td>
                    <td>{{ComFunJS.FnFormat(el.CRUser,{"format": "username"})|html}}</td>
                    <!--<td>
                        <a class="cz-btn ft18 js-color" data-toggle="tooltip" title="审批" ms-click="ViewForm(el.ID,el.intProcessStanceid,$event)" ms-if="el.StateName!='-1'&&search.seartype==2">
                            <i class="iconfont icon-user"></i>
                        </a>
                    </td>-->
                    <td>
                        <span class="btn-click">
                            <a class="cz-btn ft18 sc-color tip" data-toggle="tooltip" title="删除"  ms-click="DELHT(el,$event)">
                                <i class="iconfont icon-shanchu"></i>
                            </a>
                                 <a class="cz-btn ft18 tip " ms-class-1="sc-color:el.Status=='1'" data-toggle="tooltip" ms-attr-title="el.Status=='1'?'取消置顶':'置顶'"  ms-click="ZHIDING(el,$event)">
                                <i class="iconfont icon-shezhi"></i>
                            </a>
                        </span>
                    </td>
                </tr>

            </tbody>
            <tfoot>
                <tr ms-if="isnull"><td class="tc"></td><td>暂无数据</td></tr>
            </tfoot>
        </table>
        <div class="ui-datatable-page ft14 pl20">

            <div id="pageDiv" ms-visible="model.page.total>model.pageNum[0].num" class="pull-right"></div>
            <div class="pull-right" ms-visible="tmpListData.size()!=0">
                <span>共{{model.page.total}}条记录</span>
                <span ms-visible="model.page.total>model.pageNum[0].num">
                    选择每页条数
                    <select style="height: 25px; width: 50px;" ms-change="selNum(this.value)" ms-duplex="model.page.pagecount">
                        <option ms-repeat-pg="pageNum" ms-attr-value="pg.num" ms-attr-selected="pg.num==model.page.pagecount?'selected':''">{{pg.num}}</option>
                    </select>
                </span>
            </div>

        </div>
    </div>
  
</div>

<script>

    var tempindex = avalon.define({
        $id: "TSSQLIST",
        tmpListData: [],
        userName: ComFunJS.getnowuser(),
        InitWigetData: function () {

            //显示的列名
            model.ShowColumns.clear();

            //类型数据

            model.search.seartype = 3;
            model.GetTypeData("19");
            tempindex.GetLIST();
        },
        SelectType: function (type) {
            model.search.seartype = type;
            tempindex.GetLIST();
        },
        curXJType: "",
        SelectXJType: function (type) {
            tempindex.curXJType = type;
            tempindex.GetLIST();
        },
        ZHIDING: function (item) {
            $.getJSON('/API/VIEWAPI.ashx?Action=TSSQ_SETJH', { "P1": item.ID, "P2": item.Status == "0" ? "1" : "0" }, function (result) {
                if (result.ErrorMsg == "") {
                    item.Status = item.Status == "0" ? "1" : "0";
                    top.ComFunJS.winsuccess("操作成功");
                }
            })
        },
        selNum: function (item) {    //选择显示的条数
            model.page.pagecount = item;
            tempindex.GetLIST();
        },
        GetLIST: function () {
            model.page.pageindex = 1;
            tempindex.tmpListData.clear();
            $.getJSON('/API/VIEWAPI.ashx?Action=TSSQ_GETHTLIST', { P1: "-1", pagecount: model.page.pagecount, p: model.page.pageindex, Content: model.search.searchcontent, lb: tempindex.curXJType }, function (resultData) {
                if (resultData.ErrorMsg == "") {
                    tempindex.tmpListData = resultData.Result;
                    model.page.total = resultData.Result1;
                    if (tempindex.tmpListData.size() == 0) { model.isnull = true; } else { model.isnull = false; }
                    model.Total = resultData.Result1;
                    laypage({
                        cont: 'pageDiv', //容器。值支持id名、原生dom对象，jquery对象。
                        pages: Math.ceil(parseInt(resultData.Result1) * 1.0 / model.page.pagecount), //通过后台拿到的总页数
                        curr: 1, //初始化当前页
                        skin: 'molv',
                        jump: function (e) { //触发分页后的回调
                            if (e.curr != model.page.pageindex) {
                                $.getJSON('/API/VIEWAPI.ashx?Action=TSSQ_GETHTLIST', { P1: "-1", pagecount: model.page.pagecount, p: e.curr, Content: model.search.searchcontent, lb: tempindex.curXJType }, function (resultData) {
                                    if (resultData.ErrorMsg == "") {
                                        tempindex.tmpListData = resultData.Result;
                                    }
                                })
                                model.page.pageindex = e.curr;
                            }
                        }
                    });
                }
            })
        },
        View: function (id) {
            ComFunJS.winviewform("/ViewV5/AppPage/TSSQ/TSSQView.html?ID=" + id + "&r=" + Math.random(), "详细信息", "700", "600");
        },
        DELHT: function (item, event) {
            if (event.stopPropagation) {
                event.stopPropagation();
            }
            top.ComFunJS.winconfirm("确认要删除吗？", function () {
                $.getJSON('/API/VIEWAPI.ashx?Action=TSSQ_DELHTBYID', { "P1": item.ID }, function (result) {
                    if (result.ErrorMsg == "") {
                        top.ComFunJS.winsuccess("删除成功");
                        tempindex.tmpListData.remove(item);
                    }
                })
            })
        }, viewfile: function (file) {
            if (ComFunJS.isPic(file.FileExtendName)) {
                ComFunJS.viewbigimg(this)
                return;
            }
            if (ComFunJS.isOffice(file.FileExtendName) && file.ISYL == "Y") {
                window.open(file.YLUrl);
                return;
            }
        }
    })
    //# sourceURL=TSSQLIST.js;
</script>
